package com.incms.web.modules.system.dao;

import org.springframework.stereotype.Repository;

import com.incms.web.common.dao.BaseDaoImpl;
import com.incms.web.common.util.Page;
import com.incms.web.modules.system.entity.SysUser;

@Repository("sysUserDao")
public class SysUserDao extends BaseDaoImpl {
	public Page<SysUser> querySysUserPage(SysUser sysuser,Page<SysUser> page){
		return this.queryForListPage("SysUserMapper.querySysUserPage", sysuser, page);
	}
	
	public Long save(SysUser sysUser){
		this.save("SysUserMapper.saveSysUser",sysUser);
		return sysUser.getUserId();
	}
	
	public SysUser findByUsername(String username){
		return this.findOne("SysUserMapper.findByUsername",username);
	}
	
	public SysUser findById(Long userId){
		return this.findOne("SysUserMapper.findByUserId", userId);
	}
	
	public Long update(SysUser sysUser){
		this.save("SysUserMapper.updateSysUser",sysUser);
		return sysUser.getUserId();
	}

	public Long delete(Long userId) {
		return this.delete("SysUserMapper.deleteSysUser", userId);
	}
}
